
$(document).ready(function () {
    $('.btn-check-bulletin').click(function () {
        var bulletinId = $(this).parent().prev().text();
        $.ajax({
            url: '/api/bulletin/' + bulletinId,
            dateType: 'json'
        })
            .done(function (bulletin) {
                if (bulletin == null)
                    return;

                fillUpBulletinDialog(bulletin);
                UIkit.modal('#dialog_bulletin').show();
            })
    })
});

function fillUpBulletinDialog(bulletin) {
    var header = $('#dialog_bulletin h1')[0];
    var paragraph = $('#dialog_bulletin p');
    header.innerText = bulletin.title;
    paragraph[0].innerText = bulletin.releaseTime;
    paragraph[1].innerText = bulletin.content;
}